/**
 *
 */
package net.zantetu.matomeroid.dto;

import java.io.Serializable;
import java.util.Stack;

/**
 * 画面遷移用履歴DTO。
 * 永続化はしない。アプリケーションを起動するごとに新規作成する
 * @author aono_masashi
 *
 */
public class PageHistoryDto implements Serializable{

	private static final long serialVersionUID = 5241607961012060895L;
	private Stack<Integer> previousPageIdList;
	private Stack<Integer> nextPageIdList;

	public PageHistoryDto(){
		previousPageIdList = new Stack<Integer>();
		nextPageIdList = new Stack<Integer>();
	}

	public void pushNextPageIdList(int pageId){
		nextPageIdList.push(pageId);
	}

	public void pushPreviousPageIdList(int pageId){
		previousPageIdList.push(pageId);
	}

	public int popNextPageIdList(){
		return (!nextPageIdList.empty()) ? nextPageIdList.pop() : null;
	}

	public int popPreviousPageIdList(){
		return (!previousPageIdList.empty()) ? previousPageIdList.pop() : null;
	}
}
